package org.ecloud.biz.api.service;

import java.util.List;

import org.ecloud.biz.api.mapper.ApiMapper;
import org.ecloud.biz.api.model.ApiPo;
import org.ecloud.utils.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ApiService {

	@Autowired
	private ApiMapper mapper;
	
    public void save(ApiPo po){
    	if (po.getId() != null) {
            mapper.updateById(po);
        } else {
        	mapper.insert(po);
        }
    }

    public void delete(Long id){
    	mapper.deleteById(id);
    }

    public void delete(Long[] ids){
    	if(BeanUtil.isNotEmpty(ids)){
    		for(Long id : ids){
    			delete(id);
    		}
    	}
    }
    
    public void delete(List<Long> ids){
    	if(BeanUtil.isNotEmpty(ids)){
    		for(Long id : ids){
    			delete(id);
    		}
    	}
    }
    
}
